<!DOCTYPE html>
html(lang="en")
    head
        include ../includes/common/meta.pug
        title 车行家 - 最放心的二手车买卖平台
    body
        -
            navActive = navActive || 'sc'
            ssr = ssr || 0
            infoList = info && info.list && info.list.map(function (item) {return {date: '2019-02-25', text: item.title, href: "#", image: item.image, content: item.content, id: item.id, createdTime: item.createdTime}}) || [
                            //- {date: '2019-02-25', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                            //- {date: '2019-02-24', text: '强强联合 助推双创服务提质增效—贵州花溪农村商业银行授信车行overflow', href: '#'},
                            //- {date: '2019-02-23', text: '陶副省长代表国家工业和信息化部为车行家等“小微双创示范基地”aaaa', href: '#'},
                            //- {date: '2019-02-22', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                            //- {date: '2019-02-21', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                            //- {date: '2019-02-21', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                            //- {date: '2019-02-21', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                            //- {date: '2019-02-21', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                        ]
            infoBanner = infoList.filter(function(item) {return item.image})
            //- console.log(info)
            newsList = news && news.list && news.list.map(function (item) {return {date: '2019-02-25', text: item.title, href: "#", image: item.image,  content: item.content, id: item.id, createdTime: item.createdTime}}) || [
                                //- {date: '2019-02-25', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                                //- {date: '2019-02-24', text: '强强联合 助推双创服务提质增效—贵州花溪农村商业银行授信车行overflow', href: '#'},
                                //- {date: '2019-02-23', text: '陶副省长代表国家工业和信息化部为车行家等“小微双创示范基地”aaaa', href: '#'},
                                //- {date: '2019-02-22', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                                //- {date: '2019-02-21', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                                //- {date: '2019-02-20', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                                //- {date: '2019-02-19', text: '二手车跨区域交易成主流趋势，或将铸就行业新格局！', href: '#'},
                            ]

            topDate = newsList[0] && newsList[0].date.split('-') || [];
            newsTop = {
                year: topDate[0],
                month: topDate[1],
                day: topDate[2],
                text: newsList[0] && newsList[0].text,
                content: newsList[0] && newsList[0].content
            };
            if (newsList[0]) newsTop.id = newsList[0].id
            newsBanner = newsList.slice(0).filter(function(item) {return item.image})
            newsList = newsList.slice(1)

        include ../includes/common/common.pug
        include ../includes/header/sc-header.pug

        include ../includes/sc-banner/sc-banner.pug

        mixin textList (items, path)
            console.log(items)
            .info-text-list
                each item in items
                    - item = item || {}
                    .text-item
                        span.time
                            +dateFormat(item.createdTime)
                        a.link(href=BASE_URL + path + '?id=' + item.id)=item.text

        mixin carousel (items)
            .layui-carousel&attributes(attributes)
                div(carousel-item)
                    each item in items
                        a.banner-item(style="background-image:url("+ IMAGE_PREFIX + item.image + ")")

        .layui-container
            .info-section.clearfix
                .section-header.clearfix
                    h2.section-title 信息公示
                    a.view-more(href=ssr ? BASE_URL + "/info" : "./news.html")
                        span 查看更多
                        i.layui-icon.layui-icon-right
                .section-content
                    .content-left
                        +textList(infoList, '/news_detail')
                    .content-right
                        +carousel(infoBanner)(id="news_carousel" class="mode-2")
        .entries-section
            .layui-container
                .entry.entry-left
                    h3.title 我要创业
                    .desc 跨国企业寻合作，资方齐抛橄榄枝（投融界第317期VIP投资发展沙龙成功举
                    .entry-btn#pioneering_hook 填写信息
                .entry.entry-right
                    h3.title 我要投资
                    .desc 国家或企业以及个人，为了特定目的，与对方签订协议，促进社会发展，实现互惠互利，输送资金的过程。
                    .entry-btn#invest_hook 填写信息

        .news-section
            .layui-container
                .section-header.clearfix
                    h2.section-title 新闻动态
                    a.view-more(href=ssr ? BASE_URL + "/news" : "./news.html")
                        span 查看更多
                        i.layui-icon.layui-icon-right
                .news-section
                    .content-left.col
                        +carousel(newsBanner)(id="info_carousel" class="mode-3")
                    .content-right.col
                        a(href=BASE_URL + '/news_detail?id=' + newsTop.id)
                            .news-list-top
                                .news-top-left
                                    .year=newsTop.year + '年'
                                    .day=newsTop.day
                                    .month=newsTop.month + '月'
                                .news-top-right
                                    .title=newsTop.text
                                    .desc !{newsTop.content}
                        +textList(newsList, '/news_detail')

        script(id="tpl_invest" type="text/html")
            .form-wrap
                form.layui-form(action="javascript:void(0);")
                    +formInput({label: '姓名', placeholder:"请输入您的姓名", name: 'name', value: ''})(required lay-verify="required")
                    +formInput({label: '公司名称', placeholder:"请输入您的公司名称", name: 'companyName', value: ''})(required lay-verify="required")
                    +formUpload({id: 'image_upload1', label: '公司营业执照照相上传', placeholder:"请选择上传路径", name: '',})
                    +formInput({label: '联系方式', placeholder:"请输入您的联系方式", name: 'contactPhoneNumber', value: ''})(required lay-verify="required|phone")
                    +formInput({label: '预计投资金额', placeholder:"请输入您的投资金额", name: 'investmentAmount', value: ''})(required lay-verify="required")
                    +formTextarea({label: '对投资项目偏好', placeholder:"请填写您对投资项目的偏好", name: 'investmentPreference', value: ''})(required lay-verify="required")
                    button.form-submit-btn(lay-submit lay-filter="invest") 提交

        script(id="tpl_pioneering" type="text/html")
            .form-wrap
                form.layui-form(action="javascript:void(0);")
                    +formInput({label: '姓名', placeholder:"请输入您的姓名", name: 'name', value: ''})(required lay-verify="required")
                    //- +formInput({label: '身份证', placeholder:"请输入您的有效身份证号", name: 'idCardNumber', value: ''})(required lay-verify="required|identity")
                    +formUpload({id: 'image_upload2', label: '身份证照片上传', placeholder:"请上传两寸照片", name: '',})
                    +formInput({label: '联系电话', placeholder:"请输入您的电话号码", name: 'contactPhoneNumber', value: ''})(required lay-verify="required|phone")
                    +formInput({label: '资金需求', placeholder:"如有自有资金可不填写", name: 'fundDemand', value: ''})
                    +formInput({label: '场地需求', placeholder:"有场地可不填写", name: 'idCardNumber', value: ''})
                    //- +formSelect({label: '信息分类', options: [
                    //-     {value: 1, name: 1},
                    //-     {value: 2, name: 2},
                    //-     {value: 3, name: 3},
                    //- ]})
                    +formTextarea({label: '创业需求', placeholder:"创业、创新、就业、扶持、企业孵化、创业孵化，现有项目孵化、融资、社会资源类、其它", name: 'demand', value: ''})(required lay-verify="required")
                    +formTextarea({label: '创业项目简介', placeholder: '简单描述创业项目的想法和需求', name: 'description'})(required lay-verify="required")
                    button.form-submit-btn(lay-submit lay-filter="pionneering") 提交
        include ../includes/footer/footer.pug
